summaryrefslogtreecommitdiff
path: root/namegen.py
diff options
context:
space:
mode:
Diffstat (limited to 'namegen.py')
-rwxr-xr-xnamegen.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/namegen.py b/namegen.py
index 7eb2c86..7419331 100755
--- a/namegen.py
+++ b/namegen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
namegen.py
@@ -96,15 +96,15 @@ class Stats:
for name in fp.readlines():
name = name.decode('utf-8')
- for i in xrange(min(self.context,len(name))):
+ for i in range(min(self.context,len(name))):
self._increment_stats(name[0:i],name[i])
- for i in xrange(self.context,len(name)):
+ for i in range(self.context,len(name)):
self._increment_stats(name[i-self.context:i],name[i])
def load_stats(self,fp):
"""Load stats from json in a file-like object."""
self.stats = json.load(fp)
- self.context = max([len(k) for k in self.stats.keys()])
+ self.context = max([len(k) for k in list(self.stats.keys())])
def save_stats(self,fp):
"""Save stats in json to a file-like object."""
@@ -199,8 +199,8 @@ def main():
except (TypeError, ValueError):
n = 1
- for i in xrange(n):
- print mystats.generate_name(),
+ for i in range(n):
+ print(mystats.generate_name(), end=' ')
if __name__ == '__main__': main()