my pycharm is not working properly

0 atharv bhute · August 23, 2015
i gave input =

print['i hope so it works']

and i got output lke this=

C:\Python34\python.exe "F:/my making/my .py/first.py"
Traceback (most recent call last):
  File "F:/my making/my .py/first.py", line 1, in <module>
    print['i hope so it works']
TypeError: 'builtin_function_or_method' object is not subscriptable

Process finished with exit code 1

why please help me

Post a Reply

Replies

Oldest  Newest  Rating
+1 Otto Von Chesterfield · August 23, 2015
To be frank, it's not Pycharm that's not working.
It's your code.

I'll teach you step-by-step what the error means.

C:\Python34\python.exe "F:/my making/my .py/first.py"


The first line tells you what file is being run in Pytyon. In this case, it's first.py.

Traceback (most recent call last):


If you have multiple methods in your code, this would be more useful, but since your script is just one line, you shouldn't worry about this for now.



File "F:/my making/my .py/first.py", line 1, in <module>
print['i hope so it works']




Your error happens at line 1 of your script. <module> is just a placeholder name. If you're importing other scripts, this would be more useful.
Line 1 is "print['i hope so it works']", as the error shows.

TypeError: 'builtin_function_or_method' object is not subscriptable


A TypeError, means that you got the wrong type of object.
"... object is not subscriptable" means that you're trying to get an object from a list or dictionary.
The program thinks that you're trying to get something from a dictionary because you use the square brackets [] instead of the parentheses ().
Instead, your line should look like this:
print("I hope so it works")

The parentheses means that you're calling an object as a function.


It this helps, click on the number to the left of my picture!
  • 1

Python

106,940 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator