Python spacing and tab issue
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?
@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! :)
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.
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
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
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
if name == "main":
# Query the price once every N seconds.
for _ in xrange(N):
quotes = json.loads(urllib2.urlopen(QUERY.format(random.random())).read())
for quote in quotes:
stock, bid_price, ask_price, price = getDataPoint(quote)
prices[stock] = price
print ("Quoted %s at (bid:%s, ask:%s, price:%s)" % (stock, bid_price, ask_price, price))
print"Ratio %s" % getRatio(prices['ABC'], prices['DEF'])