字符串去从

[oracle@oadb ~]$ cat a1.py 
str='abaccadefgfe';
d={};
for x in str:
  print x
  d[x]=x
print '--------------------'
print d
[oracle@oadb ~]$ python a1.py
a
b
a
c
c
a
d
e
f
g
f
e
--------------------
{'a': 'a', 'c': 'c', 'b': 'b', 'e': 'e', 'd': 'd', 'g': 'g', 'f': 'f'}


原文地址:https://www.cnblogs.com/hzcya1995/p/13349306.html