LPTHW NOTES 2

作者: 小黑天天快乐 | 来源:发表于2016-11-03 09:24 被阅读3次

    What is the difference between %r and %s?

    We use %r for debugging, since it displays the “raw” data of the variable, but we use %s and others for displaying to users.

    I get the error TypeError: not all arguments converted during string formatting.

    You need to make sure that the line of code is exactly the same. What happens in this error is you have more % format characters in the string than variables to put in them. Go back and figure out what you did wrong.

    what’s the difference between input() and raw_input()?

    input() tries to convert everything you enter as python code, but it has safety problems, so we should try to avoid it, but raw_input() will take everything as a string.

    argument variable

    from sys import argv

    .. .. .. = argv

    argv is given when you run the program in the terminal

    相关文章

      网友评论

        本文标题:LPTHW NOTES 2

        本文链接:https://www.haomeiwen.com/subject/udsmuttx.html