Hello,
is there any way how to put such a code into more lines?
is there any way how to put such a code into more lines?
print(f'string{variable}string...')
Format text and variables - more lines
|
Hello,
is there any way how to put such a code into more lines? print(f'string{variable}string...')
two examples (I would go for the first one):
print(f'string\n{variable}\n\nstring...') print(f'''string {variable} string...''')Is that what you were looking for?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Jan-08-2019, 02:58 PM
Thanks, what I want is to make my code more readable, so I went for the second one.
And one additional question - is there any way how to make output of this print without these quotation marks "? Actually I want to write this into a file and there would be nice to have just a clear text.
quotation marks denote it's a string. when writing to text file properly they will not be present (at least in most of the cases - there are certain cases when you DO want to quote what you write to the file). show your code in python tags, so we can help - you are doing something wrong. Is the reason to ask how to put them on different lines is to have them on different lines in the file?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs |
|