Skip to main content

All Questions

Tagged with
1 vote
2 answers
177 views

I don't understand the output of enumerate (0, 0), (1,[])

This is my output: [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']] (0, 0) (1, ['apples', 'oranges', 'cherries', 'banana']) (0, 1) (...
Jarne Vercruysse's user avatar
1 vote
0 answers
113 views

OLS Regression results are compact and difficult to see. How do I enlarge or space more effectively

I am using Dataspell. I am new to python coding and going through a course right now. I am working on regressions and each time I do a regression output, it is fairly small (web:853x496 px), to the ...
Silvok1's user avatar
  • 21
0 votes
1 answer
128 views

How to satisfy output line length, code line length and Black code formatting at the same time? I.e. textwrap.wrap drop whitespace before wrapping?

This might be an XY-problem regarding the question about textwrap.wrap. I don't need to use textwrap.wrap if there's an easier way. I want to satisfy the following three criteria: Printed output text ...
finefoot's user avatar
  • 11.4k
0 votes
4 answers
60 views

For loop - Efficient way of print

I required some help in correcting the output. I am suppose to display an output like this: d:7,s:7,e:6,j:4,w:3 Is there a way to remove the , after the w:3? Current code for i in high: print(i[0]...
1g0tquestions's user avatar
0 votes
1 answer
104 views

Pandas - All I want is a single series value output with not other metadata

I have 2 dataframes that I have successfully merged together which results in a single desired row of data. Then I successfully determined the whole value difference between two integer columns. Now ...
user avatar
0 votes
1 answer
359 views

How to format a list of nested dictionaries for writing to a file in a human readable form

I have a large list where each element of the list is a dictionary. In the dictionary there is nested another list which itself contains hundreds of key:value pairs. I would like to write this list to ...
Jan Pisl's user avatar
  • 1,203
1 vote
2 answers
368 views

How to format a list to rows with certain number of items?

I'm having issues on formatting a list to a formatted output that each row contains five elements but I am stuck. words = ["letter", "good", "course", "land", "car", "tea", "speaker",\ "...
allendom's user avatar
1 vote
1 answer
1k views

Need help on formatting of output in pycharm - python

I am using JetBrains Pycharm (Windows OS) for python coding. In my code, I read a csv file using pd.read_csv(dataset). Then do few moderation on some of the table columns & finally want to see the ...
Deba's user avatar
  • 11
-1 votes
1 answer
45 views

Python formatting my json output [duplicate]

# -*- coding: utf-8 -*- import json from pprint import pprint drink_list = [23,601,633,673,607,662,6622,6014,6104,615,038,606,607,627,6094] filename = (r'C:\Users\desktop\pizza\123template.json') ...
the hank's user avatar
5 votes
2 answers
2k views

How can I print numbers in python with thin space characters as the thousands separators?

I know for example "{:,}".format(123456789) will print '123,456,789' as output in python. However, instead of the commas I would like the thin space character as the thousands separator. According ...
redwood_gm's user avatar
1 vote
5 answers
194 views

Printing out a text file (Python)

I am making a Quiz. When I try to print the results which are stored in a file, this is the output: Instead of actually creating new lines when there is a '\n' it prints the '\n' instead. ['\n', '...
Jamie Wilson's user avatar
4 votes
4 answers
1k views

Python - Format a list so elements are not split between lines

I wrote a program to list all the prime numbers less than a number the user inputs. When I run the program in PyCharm, the output is very nice: each number is properly situated on the line and no ...
Jeff Moorhead's user avatar
0 votes
1 answer
1k views

Auto-Format String Python

How can I automatically format a string in Python? I'm trying to print the remainders of pascal's triangle modulo seven, up to a row number specified by the user. Furthermore, I want it to be ...
Bolce Bussiere's user avatar
0 votes
1 answer
313 views

Python Formatting Output

I have the following code: import options import random class Player(): def __init__(self): self.name = None self.gold = 100 self.maxhealth = 100 self.health = ...
Diggy.'s user avatar
  • 6,944
1 vote
2 answers
651 views

Python Terminal Text Output Formatting

I have a python program that outputs a few numpy matricies and some other information to my terminal in this fashion: Currently, to view the data, I follow this order: Print data Clear Screen Re print ...
Tanishq dubey's user avatar

15 30 50 per page