#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time : 2018-01-15 20:40# @Author : hhj# @Site : ## [0, 1, 2, 3, 4]# [0, 1, 2, 3, 4]# [0, 1, 2, 3, 4]# [0, 1, 2, 3, 4]# [0, 1, 2, 3, 4]# ----------------二维数组90度旋转----# [0, 0, 0, 0, 0]# [1, 1, 1, 1, 1]# [2, 2, 2, 2, 2]# [3, 3, 3, 3, 3]# [4, 4, 4, 4, 4]data=[[col for col in range(10)] for row in range(5)] for col in data:print(col) # 方法一for r_index,row in enumerate(data): for c_index in range(r_index,len(row)): temp=data[c_index][r_index] data[c_index][r_index] =row[c_index] data[r_index][c_index]=temp print("--------------------%s" %r_index) for r in data:print(r)# 方法二n=len(data)for i in range(len(data)): a=[data[i][i] for row in range(n)] print(a) # [0, 1, 2, 3, 4] # [0, 1, 2, 3, 4] # [0, 1, 2, 3, 4] # [0, 1, 2, 3, 4] # [0, 1, 2, 3, 4] # ----------------二维数组90度旋转---- # [0, 0, 0, 0, 0] # [1, 1, 1, 1, 1] # [2, 2, 2, 2, 2] # [3, 3, 3, 3, 3] # [4, 4, 4, 4, 4]
G
M
T
Detect language Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bengali Bosnian Bulgarian Catalan Cebuano Chichewa Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Esperanto Estonian Filipino Finnish French Galician Georgian German Greek Gujarati Haitian Creole Hausa Hebrew Hindi Hmong Hungarian Icelandic Igbo Indonesian Irish Italian Japanese Javanese Kannada Kazakh Khmer Korean Lao Latin Latvian Lithuanian Macedonian Malagasy Malay Malayalam Maltese Maori Marathi Mongolian Myanmar (Burmese) Nepali Norwegian Persian Polish Portuguese Punjabi Romanian Russian Serbian Sesotho Sinhala Slovak Slovenian Somali Spanish Sundanese Swahili Swedish Tajik Tamil Telugu Thai Turkish Ukrainian Urdu Uzbek Vietnamese Welsh Yiddish Yoruba Zulu |
Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bengali Bosnian Bulgarian Catalan Cebuano Chichewa Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Esperanto Estonian Filipino Finnish French Galician Georgian German Greek Gujarati Haitian Creole Hausa Hebrew Hindi Hmong Hungarian Icelandic Igbo Indonesian Irish Italian Japanese Javanese Kannada Kazakh Khmer Korean Lao Latin Latvian Lithuanian Macedonian Malagasy Malay Malayalam Maltese Maori Marathi Mongolian Myanmar (Burmese) Nepali Norwegian Persian Polish Portuguese Punjabi Romanian Russian Serbian Sesotho Sinhala Slovak Slovenian Somali Spanish Sundanese Swahili Swedish Tajik Tamil Telugu Thai Turkish Ukrainian Urdu Uzbek Vietnamese Welsh Yiddish Yoruba Zulu |
Text-to-speech function is limited to 200 characters
Options : History : Feedback : Donate | Close |
原文地址:https://www.cnblogs.com/hhjwqh/p/8401774.html
时间: 2024-10-06 00:53:25