是否有任何神奇的蟒蛇方法可以获得每个名字的第一个字母并加入'@ company.com'来创建电子邮件地址?
我是这样做的:
<html>
<head>
<!-- Materialize.css -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>
</head>
<body>
<div class="container lucy-terms">
<div class="row">
<div class="col s12 m12">
<div class="card-panel lucy-card-panel">
<div class="card-content">
<h4 class="center-align">Terms of Use</h4>
<p class="flow-text uppercase">PLEASE NOTE THAT YOUR USE OF AND ACCESS TO OUR SERVICES (DEFINED BELOW) ARE SUBJECT TO THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO ALL OF THE FOLLOWING, YOU MAY NOT USE OR ACCESS THE SERVICES IN ANY MANNER.</p>
<p class="flow-text">Effective date: April 2, 2018</p>
</div>
</div>
</div>
</div>
</body>
</html>
结果为Rank = IF (
HASONEVALUE ( Table_Name[ColumnName for which Ranking is required] ),
RANKX ( ALL ( Table_Name[ColumnName for which Ranking is required] ), [ColumnName on which Ranking is required])
)
答案 0 :(得分:2)
这是一些“蟒蛇魔法”
name = ['Elon Reeve Musk']
f"{''.join(filter(str.isupper, name[0]))}@company.com".lower()
>>> erm@company.com
这是否比你的方法更好是值得商榷的。大多数情况下,一行易读的代码比一行黑客更好。
我的建议是
name = ['Elon Reeve Musk']
initials = ''.join(word[0] for word in name[0].split())
f'{initials.lower()}@company.com'
>>> erm@company.com