autopep8 automatically formats Python code to conform to the PEP 8 style guide.
Questions tagged [autopep8]
99 questions
0
votes
0 answers
How to auto convert % string formatting to modern .format() method
I'm looking for a way to convert obsolete % string formatting operator to format() function in python3 code.
ugly = 'Exception: the %s is over %+f' % (t, value)
good = 'Exception: the {} is over {:+f}'.format(e, value)
Sure, I use autopep8 on save…

Sergey Belash
- 1,433
- 3
- 16
- 21
0
votes
1 answer
autopep8 exclude files by extensions
I try to use command autopep8 the such way
autopep8 --in-place --exclude='*.js,*.jade,*.styl'
autopep8 --in-place --exclude='*.styl'
autopep8 --in-place --exclude=*.js,*.jade,*.styl
autopep8 --in-place --exclude=*.styl
all these methods do not work…

fedorshishi
- 1,467
- 1
- 18
- 34
0
votes
0 answers
W602 raise ValueError - How has the message to look like?
I am very new to python and my first task is to check older code (not mine!) to convert it according to pep8.
I have the following code block and I should change raise ValueError to raise ValueError("Message"). How has the syntax of the message to…

Til Hund
- 1,543
- 5
- 21
- 37
-1
votes
0 answers
Autopep8 not working in vscode. I have made the right settings. Not sure why
Autopep8 not working in vscode. I have made the right settings.
Please take a look of the pictures down below.
The python code was not auto formatted when i press ctrl +s.

bingru
- 51
- 3
-1
votes
2 answers
Python - formatting problem with print()-function - Why does formatting (autopep8) pushes my print statement after `print(` to the next line?
I noticed that parts of my last print()-function statement got pushed down when I formatted it with autopep8 in VSC and I don't understand why. This only occurs, if I have the temp foor loop variable {guesses_Taken} inside the String.
if guess ==…

Nico
- 3
- 1
-1
votes
1 answer
auto formatting python code to put parameters on same line
I really hate having spread out code, I am looking at a bunch of long code with parameters and arguments that are taking up way to much space.
def __init__(self,
network,
value_coef,
…

Max Hunter
- 40
- 4
-1
votes
2 answers
Autopep8: Custom Indent
How can I keep AutoPep8 formatter in Python from formatting my custom indents?
From this:
class Product(models.Model):
title = models.CharField()
description = models.TextField()
price = models.DecimalField()
…

Tobias Weger
- 105
- 8
-3
votes
2 answers
break in running program in python
when i run this code in terminal** i should prees" enter " key to run after line 6 **
i dont know the problem
i'm in the learning python proccess
thank all of you in advance........
print("hi dear,\n welcom to my program in python")
name =…

misagh
- 3
- 3