TypeError: 'str' object is not callable (Python)

后端 未结 16 1140
忘了有多久
忘了有多久 2020-11-22 11:44

Code:

import urllib2 as u
import os as o
inn = \'dword.txt\'
w = open(inn)
z = w.readline()
b = w.readline()
c = w.readline()
x = w.readline         


        
16条回答
  •  清酒与你
    2020-11-22 12:12

    An issue I just had was accidentally calling a string

    "Foo" ("Bar" if bar else "Baz")
    

    You can concatenate string by just putting them next to each other like so

    "Foo" "Bar"
    

    however because of the open brace in the first example it thought I was trying to call "Foo"

提交回复
热议问题