About 126,000 results
Open links in new tab
  1. python - How do you create different variable names while in a …

    It's simply pointless to create variable variable names. Why? They are unnecessary: You can store everything in lists, dictionarys and so on; They are hard to create: You have to use exec …

  2. python - How do I create variable variables? - Stack Overflow

    Any set of variables can also be wrapped up in a class. "Variable" variables may be added to the class instance during runtime by directly accessing the built-in dictionary through __dict__ …

  3. How to set environment variables in Python? - Stack Overflow

    os.environ behaves like a python dictionary, so all the common dictionary operations can be performed. In addition to the get and set operations mentioned in the other answers, we can …

  4. Creating dummy variables in pandas for python - Stack Overflow

    You can create dummy variables to handle the categorical data # Creating dummy variables for categorical datatypes trainDfDummies = pd.get_dummies(trainDf, columns=['Col1', 'Col2', …

  5. python - How can you dynamically create variables? - Stack Overflow

    Sep 18, 2021 · # create a dictionary >>> kwargs = {} # add a key of name and assign it a value, later we'll use this key as a variable >>> kwargs['name'] = 'python' # an example function to …

  6. python - Create dictionary from list of variables - Stack Overflow

    Feb 29, 2012 · I'm looking for a way to create a dictionary without writing the key explicitly. I want to create a function that gets the number of variables and creates a dictionary where the …

  7. python - How can I create new variables in a loop, with the names …

    Python: How to create new variables in for loops? 3. How to generate new list from variable in a loop? 1 ...

  8. python - Create file path from variables - Stack Overflow

    Sep 20, 2010 · I am looking for some advice as to the best way to generate a file path using variables, currently my code looks similar to the following: path = /my/root/directory for x in …

  9. Programmatically creating variables in Python - Stack Overflow

    Feb 1, 2011 · The cleanest approach by far that I have ever seen is to directly add variables (i.e. attributes) to your program (i.e. main module), as answered in another question on …

  10. How can I access environment variables in Python?

    Feb 5, 2011 · pip install python-dotenv After that, create a .env file that has the following entry: BASE_URL = "my_base_url" Then import the module into your Python file. import os from …

Refresh