0
else:
      fullName = curLineFin[1] + ' ' + curLineFin[2]
      players[fullName] = curLineFin[0] + '\t' + curLineFin[1] + \
      '\t' + curLineFin[2] + '\t' + curLineFin[3] + '\t' + \
      curLineFin[4] + '\t' + curLineFin[5] + '\t' + curLineFin[6] + \
      '\t' + curLineFin[7] + '\t' + curLineFin[8] + '\t' + \
      curLineFin[9] + '\t' + curLineFin[10] + '\t'

Every time I run the script, I get the error:

players[fullName] = curLineFin[0] + '\t' + curLineFin[1] + \
                                                           ^

IndentationError: unindent does not match any outer indentation level

alko
  • 46,136
  • 12
  • 94
  • 102
user2896865
  • 65
  • 1
  • 2
  • 7
  • aren't you simply missing the \ at the end of the first line? – Brad Allred Nov 01 '13 at 23:16
  • @BradAllred : fullName is a separate variable. The second line is setting a key to equal a value in the dictionary. – user2896865 Nov 01 '13 at 23:20
  • possible duplicate of [IndentationError: unindent does not match any outer indentation level](http://stackoverflow.com/questions/492387/indentationerror-unindent-does-not-match-any-outer-indentation-level) – femtoRgon Nov 01 '13 at 23:29

3 Answers3

3

Wrap your code with parentheses

players[fullName] = (curLineFin[0] + '\t' + curLineFin[1] + 
      '\t' + curLineFin[2] + '\t' + curLineFin[3] + '\t' + 
      curLineFin[4] + '\t' + curLineFin[5] + '\t' + curLineFin[6] + 
      '\t' + curLineFin[7] + '\t' + curLineFin[8] + '\t' + 
      curLineFin[9] + '\t' + curLineFin[10] + '\t' )

or

players[fullName] = '\t'.join(curLineFin[:11]) + '\t'

or if this trailing tab char is not needed and you have exactly eleven elements in curLineFin.

players[fullName] = '\t'.join(curLineFin) 
alko
  • 46,136
  • 12
  • 94
  • 102
1

Just use parenthesis:

fullName = (curLineFin[1] + ' ' + curLineFin[2] +
      players[fullName] = curLineFin[0] + '\t' + curLineFin[1] + 
      '\t' + curLineFin[2] + '\t' + curLineFin[3] + '\t' + 
      curLineFin[4] + '\t' + curLineFin[5] + '\t' + curLineFin[6] + 
      '\t' + curLineFin[7] + '\t' + curLineFin[8] + '\t' + 
      curLineFin[9] + '\t' + curLineFin[10] + '\t')
dawg
  • 98,345
  • 23
  • 131
  • 206
1

The code you have posted does not generate that error, so it's impossible to diagnose exactly what's happening in the different code you're actually running.

The most likely cause is that it's completely unrelated to the backslashes, and you're doing something like mixing tabs and spaces. (The fact that you're using a weird 6-character indent for the block isn't a good sign…)

Another possibility is that you're putting extra spaces after one of the backslashes. This should usually give you a SyntaxError: unexpected character after line continuation character, but it's possible to confuse Python to the point where that passes and you get the following generic SyntaxError for a + with no right operand or IndentationError for the next line.

abarnert
  • 354,177
  • 51
  • 601
  • 671
  • judging from the fact that removing 6-chars indented lines helped, i guess that was tabs – alko Nov 01 '13 at 23:37
  • @alko: What do you mean "removing 6-chars indented lines helped"? Just copying and pasting it as-is, the code already runs just fine. (Well, you need to define `players` and `curLineFin` and put an `if False: pass` to make the `else:` work, but that's it.) Unless you have access to the OP's real code instead of what he posted here, how can you tell what helps when there's nothing to help? – abarnert Nov 01 '13 at 23:51
  • i meant he accepted my answer saying `join` helped, which means error was indeed in excerpt at hand – alko Nov 01 '13 at 23:56
  • @alko: Ah, yeah, that does prove the error was somewhere in this mess of code. But he gave us the complete traceback, with caret and everything, which was already pretty good evidence. – abarnert Nov 02 '13 at 00:01