Python 3 Start
This commit is contained in:
parent
9f029c8ceb
commit
141fe8d80c
67 changed files with 264 additions and 274 deletions
|
@ -24,7 +24,7 @@ class TextGenerator(object):
|
|||
|
||||
# replace static variables in the template with provided values
|
||||
if self.variables:
|
||||
for key, value in self.variables.items():
|
||||
for key, value in list(self.variables.items()):
|
||||
text = text.replace("{%s}" % key, value)
|
||||
|
||||
# get a list of all text parts we need
|
||||
|
@ -33,7 +33,7 @@ class TextGenerator(object):
|
|||
for required_part in required_parts:
|
||||
ppart = self.parts[required_part]
|
||||
# check if the part is a single string or a list
|
||||
if not isinstance(ppart, basestring):
|
||||
if not isinstance(ppart, str):
|
||||
part = random.choice(self.parts[required_part])
|
||||
else:
|
||||
part = self.parts[required_part]
|
||||
|
@ -43,7 +43,7 @@ class TextGenerator(object):
|
|||
|
||||
def generate_strings(self, amount, template=None):
|
||||
strings = []
|
||||
for i in xrange(amount):
|
||||
for i in range(amount):
|
||||
strings.append(self.generate_string())
|
||||
return strings
|
||||
|
||||
|
|
Reference in a new issue