how to check the syntax of python program without running the program?

0 votes
I am new to Python and still learning it. Is it possible to check the syntax of a python program without running it? If yes how can I do it?
Jun 27, 2019 in Python by Arvind
• 2,980 points
277 views

1 answer to this question.

0 votes

Yes, it is possible to check the syntax of a program without executing it. You can do it by simply compiling the program.

python -m py_compile program_name.py
answered Jun 27, 2019 by Arvind
• 2,980 points

Related Questions In Python

0 votes
1 answer

How to check the version of Python?

you can check the version of python ...READ MORE

answered Sep 25, 2018 in Python by SDeb
• 13,250 points
102 views
0 votes
1 answer

how do I check the length of an array in a python program?

lets say we have a list mylist = ...READ MORE

answered Mar 12, 2019 in Python by Mohammad
• 3,230 points
180 views
0 votes
1 answer

How to check the memory usage of an object in python

Hi, @Roshni, You can use this code below: import ...READ MORE

answered Jun 26 in Python by Gitika
• 31,430 points
42 views
0 votes
1 answer

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

answered Jun 4, 2018 in Python by aryya
• 7,370 points
213 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,075 views
0 votes
0 answers
0 votes
1 answer

How to find the type of variable in Python?

i=277 type(i) # int i = 2.56j type(i) # complex i ...READ MORE

answered Jul 16, 2019 in Python by Arvind
• 2,980 points
50 views
0 votes
2 answers