- Hands-On Data Science and Python Machine Learning
- Frank Kane
- 191字
- 2021-07-15 17:15:01
Complex data structures
You can also have complex data structures with lists. So you don't have to just put numbers in it; you can actually put strings in it. You can put numbers in it. You can put other lists in it. It doesn't matter. Python is a weakly-typed language, so you can pretty much put whatever kind of data you want, wherever you want, and it will generally be an OK thing to do:
y = [10, 11, 12]
listOfLists = [x, y]
listOfLists
In the preceding example, I have a second list that contains 10, 11, 12, that I'm calling y. I'll create a new list that contains two lists. How's that for mind blowing? Our listofLists list will contain the x list and the y list, and that's a perfectly valid thing to do. You can see here that we have a bracket indicating the listofLists list, and within that, we have another set of brackets indicating each individual list that is in that list:
[[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], [10, 11, 12]]
So, sometimes things like these will come in handy.
- MySQL數據庫管理實戰
- Dynamics 365 Application Development
- INSTANT Weka How-to
- OpenStack Cloud Computing Cookbook(Fourth Edition)
- 名師講壇:Java微服務架構實戰(SpringBoot+SpringCloud+Docker+RabbitMQ)
- Oracle Database 12c Security Cookbook
- 數據結構與算法分析(C++語言版)
- MATLAB for Machine Learning
- Python深度學習:基于TensorFlow
- Android玩家必備
- Python:Deeper Insights into Machine Learning
- Illustrator CC平面設計實戰從入門到精通(視頻自學全彩版)
- Emotional Intelligence for IT Professionals
- 高效使用Greenplum:入門、進階與數據中臺
- Arduino Electronics Blueprints