What to do with “Unexpected indent” in python?

前端 未结 17 2705
天涯浪人
天涯浪人 2020-11-22 07:46

How do I rectify the error \"unexpected indent\" in python?

17条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 08:04

    Simply copy your script and put under """ your entire code """ ...

    specify this line in a variable.. like,

    a = """ your python script """
    print a.replace('here please press tab button it will insert some space"," here simply press space bar four times")
    # here we replacing tab space by four char space as per pep 8 style guide..
    

    now execute this code, in Sublime Editor using ctrl+b, now it will print indented code in console. that's it

提交回复
热议问题