formatting

how do i name turtles after a loops index and use them afterwards

how do i name turtles after a loops index and use them afterwards Question: i am trying to make a game using images as sprites where the 10 rocks papers and scissors float about killing each other tryign to make all of them one character but i want to make the turtles easily using an …

Total answers: 1

python logging config format

python logging config format Question: I am using the python logging module with a configuration file. It is working but I would like to change the format of the output string. Currently in the config file I have a line [formatter_fileFormatter] format=[%(asctime)s] %(levelname)-8s %(name)-12s %(message)s which gives me output like this [2022-12-14 11:21:50,247] INFO my_logger.mod1 …

Total answers: 1

python string formatting single quotes and double quotes

python string formatting single quotes and double quotes Question: I have a variable state = ‘PA’. I am trying to generate a string as follows. I would like add single quotes on the state within a string. Also, I want to use this .format method because I will change this state later. ‘select * from …

Total answers: 1

Python Color Escape Sequences Different Foreground and Background color with 256 colors

ANSI Color Escape Sequences Different Foreground and Background color with 256 colors Question: I’m using the ANSI Escape Sequence codes to add color to terminal output in my program. I am mainly using this code, where COLOR can be any value between 0 and 255 to achieve great color variation. 33[38;5;COLOR;1m TEXT u001b[0m The problem …

Total answers: 1

How can i convert this log data into JSON using a python script

How can i convert this log data into JSON using a python script Question: I have log file from a Vivado simulator, which i want to convert into simple JSON to visualize it ultimately. Please suggest me a python code to format the logs into JSON. I have tried to search for converting the logs …

Total answers: 3

Formating user input into a txt file

Formating user input into a txt file Question: I am trying to format these 2 user inputs into a file on seperate lines I know I have to us the n to use a new line but I keep getting errors with where I put it, is there another way to get each user input …

Total answers: 2

How to convert user input date format to a different format on output in Python

How to convert user input date format to a different format on output in Python Question: I have a code where the date is an input converted to a date: InvDateStr = input("Enter the invoice date (YYYY-MM-DD): ") InvDate = datetime.datetime.strptime(InvDateStr, "%Y-%m-%d") I would like to later output this date in the format of "DD-Mon-YY" …

Total answers: 2