About 698,000 results
Open links in new tab
  1. What does colon equal (:=) in Python mean? - Stack Overflow

    In Python this is simply =. To translate this pseudocode into Python you would need to know the data structures being referenced, and a bit more of the algorithm implementation. Some notes …

  2. python - Importing files from different folder - Stack Overflow

    I have this folder structure: application ├── app │ └── folder │ └── file.py └── app2 └── some_folder └── some_file.py How can I import a function from file.py, from within som...

  3. python - How do I check whether a file exists without exceptions ...

    How do I check whether a file exists or not, without using the try statement?

  4. python - Iterating over dictionaries using 'for' loops - Stack Overflow

    Jul 21, 2010 · In Python 3.x, iteritems() was replaced with simply items(), which returns a set-like view backed by the dict, like iteritems() but even better. This is also available in 2.7 as …

  5. python - How do I terminate a script? - Stack Overflow

    also sys.exit () will terminate all python scripts, but quit () only terminates the script which spawned it. David C. Over a year ago Do you know if this command works differently in python …

  6. What does the "at" (@) symbol do in Python? - Stack Overflow

    96 What does the “at” (@) symbol do in Python? @ symbol is a syntactic sugar python provides to utilize decorator, to paraphrase the question, It's exactly about what does decorator do in …

  7. python - How can I add new keys to a dictionary? - Stack Overflow

    6 I think it would also be useful to point out Python's collections module that consists of many useful dictionary subclasses and wrappers that simplify the addition and modification of data …

  8. python - Count the number of occurrences of a character in a …

    How do I count the number of occurrences of a character in a string? e.g. 'a' appears in 'Mary had a little lamb' 4 times.

  9. python - How can I remove a trailing newline? - Stack Overflow

    An example in Python's documentation simply uses line.strip(). Perl's chomp function removes one linebreak sequence from the end of a string only if it's actually there.

  10. python - How do I access command line arguments? - Stack …

    I highly recommend argparse which comes with Python 2.7 and later. The argparse module reduces boiler plate code and makes your code more robust, because the module handles all …