摘要:
知识点非常简单,直接看代码 struct Person { int age; std::string name; }; int main() { std::vector<Person> v{{10, "Tom"}, {20, "lily"}}; for (const auto &[age, name 阅读全文
摘要:
map是python的内置函数,该函数接收两个参数,第一个参数为一个函数f,第二个参数s是一个序列。map会将传入的函数f应用到每一个s中的元素上。 text = [ "It is said that the true nature of being is veiled. ", "The labor 阅读全文
摘要:
列表解析的语法为: [表达式 + 上下文] 直接举个例子 运行下列代码 print([x.lower() for x in ['I', 'AM', 'ROBOT']]) # 结果 ['i', 'am', 'robot'] 这里表达式为 x.lower(), 上下文为 for x in ['I', ' 阅读全文