python python 17,040

  1. What does the “yield” keyword do?
  2. What are metaclasses in Python?
  3. Does Python have a ternary conditional operator?
  4. How to check whether a file exists?
  5. What does if __name__ == “__main__”: do?
  6. Calling an external command in Python
  7. How to merge two dictionaries in a single expression?
  8. How can I create a directory if it does not exist?
  9. How do I sort a dictionary by value?
  10. Does Python have a string 'contains' substring method?
  11. How do I list all files of a directory?
  12. How do I check if a list is empty?
  13. Difference between append vs. extend list methods in Python
  14. What is the difference between @staticmethod and @classmethod in Python?


  15. Accessing the index in 'for' loops?
  16. Using global variables in a function other than the one that created them
  17. How to make a chain of function decorators?
  18. How do I install pip on Windows?
  19. Understanding Python's slice notation
  20. Finding the index of an item given a list containing it in Python
  21. Check if a given key already exists in a dictionary
  22. Difference between __str__ and __repr__?
  23. “Least Astonishment” and the Mutable Default Argument
  24. How do I pass a variable by reference?
  25. Iterating over dictionaries using 'for' loops
  26. Making a flat list out of list of lists in Python
  27. Understanding Python super() with __init__() methods
  28. How can I make a time delay in Python?
  29. Catch multiple exceptions in one line (except block)
  30. How to get current time in Python?
  31. Is there a way to run Python on Android?
  32. Add new keys to a dictionary?
  33. How do I parse a string to a float or int in Python?
  34. How do I install pip on macOS or OS X?
  35. In Python, how do I read a file line-by-line into a list?
  36. How to clone or copy a list?
  37. How to concatenate two lists in Python?
  38. Is there a way to substring a string in Python?
  39. How do you split a list into evenly sized chunks?
  40. What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
  41. Print in terminal with colors?
  42. Are static class variables possible?
  43. How to get the number of elements in a list in Python?
  44. Hidden features of Python
  45. Manually raising (throwing) an exception in Python
  46. Find current directory and file's directory
  47. How to convert string to lowercase in Python
  48. Converting string into datetime
  49. Replacements for switch statement in Python?
  50. Upgrading all packages with pip