Ask coding questions

← Back to all posts
Python spacing and tab issue
stevemiller

Sometimes, when I enter python code directly into repl.it, i run into Python errors where the indent or spacing is reported as uneven even if I've used the tab key.

I have a workaround. I copy and the paste a previous lines tabs. It's annoying to have to do this. I work in Python 3. Is this an issue with the repl.it editor wrt to spaces/tabs?

Voters
MalatheshK
MeerimYrysbekov
JaimePad
AnamArshad
SophieElliott1
26PrashantPatid
DariaTrutneva
AakashVaidya
tayhollins
mdhritireddy
Comments
hotnewtop
HARDIKTIWARI

what's the problem is?

ArshdeepSingh10

@HARDIKTIWARI I am facing the same problem.

adipool02

@HARDIKTIWARI I am also facing the same problem.

PriyankaMehta2

@HARDIKTIWARI i am facing the same problem ..... have you found how to complete the task....

NeerajKhadagade

@HARDIKTIWARI Try doing it with "Workaround Option 1" from this PDF "https://insidesherpa.s3.amazonaws.com/vinternships/companyassets/Sj7temL583QAYpHXD/repl_mod1_v4.pdf"

It worked for me! :)

ChristopherPasa

I found in the settings when changing the indent type from spaces to tabs, the problem seemed to be fixed for me.

RobertoBean

You don't need to copy and paste the tabs from previous lines. When you place a colon, then use the down arrow key to start typing on the next line, repl.it will automatically indent the correct amount of space for you. Also, if it's already indented out to a certain place, using the down arrow key again will keep it indented at the same level.

turroscott

The quickest fix is to use command F and highlight one of the tabs that you entered. Now replace these faulty tabs with one that was used in the previous lines.

Vivekanand12

return price_a/price_b
indentation error in this line

ak11398

Still not able to fix this problem someone please help...........

totoeevee

sooooo yeah had this problem too
figured out how to fix it
so change indent type to tabs
highlight ALL your code
and DELETE IT
fixed
jkjkjkjk
so after u highlight all ur code, indent and then dedent with CMD/ctrl ] and then CMD/ctrl[.
it will auto format for you and yay

Jorgmassih

@totoeevee thanks! It worked for me

v2couto

@totoeevee im on windows

totoeevee

@v2couto use control then
Ctrl ] then Ctrl [
if anyone is on mac use CMD ] then CMD [

v2couto

@totoeevee ok thx

ShwetaJagdhane

Thanks man worked for [email protected]

LaykenGombeda

go to settings and find indent type and change it or make sure it is set as tabs, then hit CTRL + F and hit SPACE and find the line that is bugging out your code and delete it and rewrite it with tabs, should work if not then ive got no clue

Amrit-Baral


what the problem here??

sujalkadam

yes ,it's big issue

IsrarHusain

key error ABC

IsrarHusain

print("Ratio %s" %(getRatio(prices['ABC'],prices ['DEF'])))

PadmashreeJha

i am also facing