如何以非降序对python中的列表进行排序?

时间:2019-03-03 21:56:03

标签: python list sorting

我有以下列表

substitute the HTML entity for uppercase "c," i.e., C

我做了一些研究并且尝试了

    int x = 23; //user input
    String s=""; //contains all numbers from 0 to userinput
    String odd =""; //contains all odd numbers from 0 to userinput
    String even = ""; //contains all even numbers from 0 to userinput

    for(int i = 0 ; i< x+1 ; i++){
    s += i;
        if(i%2==0) //if i is an even number
            even += i;
        else //if i is an odd number 
            odd += i;
    }

    System.out.println(s); //displaying all numbers from 0 to user input
    System.out.println(odd); //displaying odd numbers from 0 to user input
    System.out.println(even); //displaying even numbers from 0 to user input

我也尝试过

while IFS= read -r line; do
    printf "%s\n" "$LINE"
    if [[ $LINE == "EXIT" ]]; then
         break;
     fi
done > "$1"

但是,两者都没有起作用。想知道我在做什么错吗?

1 个答案:

答案 0 :(得分:1)

您的方法应该有效。您希望值如何排序?

550 5.7.1 Unauthenticated email from mydomain.com is not accepted 
due to domain's DMARC policy. Please contact the administrator of 
mydomain.com domain if this was a legitimate mail. 
Please visit https://support.google.com/mail/answer/2451690 to learn about the 
DMARC initiative. s5si11407114ywe.292 - gsmtp