Simple CheatSheet
    • PythonPython
    • DatabaseDatabase
    • Operating SystemOperating System
    • ProgrammingProgramming
    • Linux CommandLinux Command
    • ToolkitToolkit
    • OtherOther
    • Keyboard ShortcutsKeyboard Shortcuts
Dart
Dart
HTML Canvas
HTML Canvas
Redis
Redis
Bash
Bash
JavaScript
JavaScript
Python
Miscellaneous

Generator to list

values = (-x for x in [1,2,3,4,5])
gen_to_list = list(values)
# => [-1, -2, -3, -4, -5]
print(gen_to_list)
Comments
Related
  • Miscellaneous
  • Python Classes & Inheritance
  • Python File Handling
  • Python Modules
  • Python Functions
  • Python Loops
  • Python Flow control
  • Python Lists
  • Python F-Strings (Since Python 3.6+)
  • Python Strings
  • Python Advanced Data Types
  • Python Built-in Data Types
  • Getting Started