Linked Questions
11 questions linked to/from python using variables from another file
29
votes
7
answers
127k
views
Importing a variable from one python script to another [duplicate]
I have script1.py which calls script2.py (subprocess.call([sys.executable, "script2.py"]). But script2.py needs variable x that is known in script1.py. I tried a very simple import x from script1, but ...
Z77's user avatar
- 1,163
1
vote
5
answers
2k
views
Best way to retrieve variable values from a python file through another python script? [duplicate]
I have many python files all with the same variable names but different values. Something like this would be in one:
var_one = 'happy'
var_two = '2345'
var_three = '-24.24'
var_four = 'Chocolate'
I ...
0
votes
1
answer
104
views
How to import variable from another file [duplicate]
I'm fairly new to Python. Here's the code in 'file1'
phrases = []
buildWord = ""
file = open("words.txt")
words = file.read()
for i in words:
if(i == "\n"):
phrases.append(buildWord)
...
0
votes
2
answers
83
views
How to use variables from another file in python? [duplicate]
I have created two files. The first one called EA contains variables and calls to functions. The second file called EA_Functions contains all the functions used in EA.
This is EA:
from EA_Functions ...
-4
votes
1
answer
829
views
python 3.6 Length function for many conditions
I have a situation where
if len(a) = 0
a = ''
if len(b) = 0
b = ''
if len(c) = 0
c = ''
If len( any object) is zero , declare it as null.
I have to keep doing this for all the alphabets . ...
-1
votes
2
answers
125
views
Python drama with variable
in python I have this set of variable
variable.py
#--------------Project 1--------------#
ip_server = '10.10.55.98'
username = 'user_1'
distro = 'debian'
#--------------Project 2--------------#
...
-1
votes
1
answer
196
views
Using variables from other python files
I'm having some problems with this:
I have two files: random and random2
random has this:
import random2
print(random2.verb_list)
print(random2.x)
random2 has this:
verb_list = ['x'...
0
votes
1
answer
155
views
How to call instance variable form another class and file
I have a question, I have 4 file app.py, face.py, camera.py and db.py Inside face.py file I have one variable call known_encoding_faces. If I put print code inside my face.py and run the app.py the ...
user avatar
user11026391
0
votes
2
answers
225
views
Imported class doesn't know local variables
I have two files (Backupfile.py and Backupfile2.py).
Following is in Backupfile.py:
class Mater:
def __init__(self):
self.func()
def func(self):
from Backupfile2 import klasse
...
0
votes
2
answers
104
views
Python modules/import data?
I have a two python files I am working with.
In cryp.py I have:
def test():
test = raw_input("> ")
In cryptek.py I have:
import cryp
What is your name?
cryp.test
print "To be sure your ...
-1
votes
1
answer
58
views
How can I include a variable to a module
Let's say I have a module that can open a website
a module is like this:
open("here is the variable from another python file")
so how can I include that variable to my module
I know there is ...