别想她

文章 评论 浏览 27

别想她 2025-02-10 19:44:55
**home.html**

    <!DOCTYPE html>
<html lang="en">

 <head>
        
  <style type=text/css>

   ul {list-style-type: none; margin: 0; padding: 0; background-color: rgb(42,157,143); overflow: hidden;}
   li{float: left;} 
   li a:link{display: block; color: black; padding: 10px; text-decoration: none;}
   li a:visited{color: orange;}
   li a:hover {background-color: rgb(38,70,83); color: blue;}
   li a.active {background-color: rgb(138,177,125); color: red;}

   .leftdiv{
      float: up;
    }

    .rightdiv{
       float: down;
       width: 100px;
     }

     div{
       padding : 1%;
       color: blue;
       /* corrected  background color to background-color*/
       background-color: white; 
       width: 40%;
       border: blue;
     }
                    
     span{
        color : blue;
        background-color: white;
        margin: 8px;
        font-size: 25x;

         /* missing the close tag */
      }

      .sprite {
         display:block;
         position:relative;
         width:50px;
         height:50px;
         border:1px solid red;
         overflow:hidden;
       }

       #fb { 
         position:absolute;
         top:0;
         left:0;
            } 

            #fb:hover {
                position:absolute;
                top:-50px;
                left:0;
            }

            form{   
                
                color : blue;
                background-color: white;
                margin: 8px;
                font-size: 25x;
            }

        </style>

        <script>

            function passvalues()

                {
                    var name=document.getElementById("name1").value;
                    localStorage.setItem("textvalues", name);
                    

                    var name=document.getElementById("name2").value;
                    localStorage.setItem("textvalue", name);
                    
                    var radio= document.getElementById("myRadio").value
                    localStorage.setItem("emailvalues", name);

                    var name=document.getElementById("radio").value;
                    localStorage.setItem("emailvalues", name);


                    var name=document.getElementById("pword").value;
                    localStorage.setItem("passwordvalues", name);
                    


                    var name=document.getElementById("tArea").value;
                    localStorage.setItem("textareavalue", name);
                    return false;
                }

        </script>
            
    </head>

    <body>

        <nav>  
          
            <form action="profile.html">
                <!-- missed " in style" -->
                <fieldset form="signup" width=10px; style="border-style:solid; color : black; border-width:1px; padding:10px; text-align:left;"> 
                    <legend>Register: </legend>
    
                    <label for="name1">*First Name:</label>
                    <input type="text" id="name1" name="name1"  required/><br><br>
                    <label for="name2">*Last Name:</label>
                    <input type="text" id="name2" name="name2"  required/><br><br>
    
                    <p>*Your Gender:</p>
                    <input type="radio" id="radio" name="gender" value="Male"  required/>
                    <label for="male">Male</label></br>
                    <input type="radio" id="radio" name="gender" value="Female"  required/>
                    <label for="female">Female</label></br>
                    <input type="radio" id="radio" name="gender" value="Prefer not say"  required/>
                    <label for="prefernotsay">Prefer Not Say</label>
                    
                    <br>
                    <br>
    
                    <label for="email">*Email Address:</label>
                    <input type="email" id="email" name="email"  required/><br><br>
    
                    <label for="number">#Number:</label>
                    <input type="text" id="number" name="Number"  required/><br><br>
    
                    <label for="pword">*Your Password: </label>
                    <input type="password" id="pword" name="pword" required/>
                    
                    <br>
                    <br>
    
                    <label for="cmmnts">*Reasons for registering: </label></br>
                    <input type="textarea" textarea id="tArea" name="cmmnts" rows="4" cols="50" required/> </textarea>
                    
                    <br>
                    <br>
                    <input type="submit" value="Submit" onclick="passvalues()"/>
    
                </fieldset>
            </form>
    
         
        </nav>

    </body>

</html>

**profile.hrml**

    <!DOCTYPE html>
<html>
<head>
</head>

    <style type=text/css>
     
        ul {list-style-type: none; margin: 0; padding: 0; background-color: rgb(42,157,143); overflow: hidden;}
        li{float: left;} 
        li a:link{display: block; color: black; padding: 10px; text-decoration: none;}
        li a:visited{color: orange;}
        li a:hover {background-color: rgb(38,70,83); color: blue;}
        li a.active {background-color: rgb(138,177,125); color: red;}

        .leftdiv{
            float: up;
        }

        .rightdiv{
            float: down;
            width: 100px;
        }

        div{
            padding : 1%;
            color: blue;
            background-color: white;
            width: 40%;
            border: blue;
        }

        span{
            color : blue;
            background-color: white;
            margin: 8px;
            font-size: 25x;
        }

        .sprite {
            display:block;
            position:relative;
            width:50px;
            height:50px;
            border:1px solid red;
            overflow:hidden;
                
        }

        #fb { 
            position:absolute;
            top:0;
            left:0;
        } 

        #fb:hover {
            position:absolute;
            top:-50px;
            left:0;
        }

    </style>

    <body>
        <div>
            <p>First Name: </p>
            <span id="name1"></span>
            <br>
            <br>
            <p>Last Name: </p>
            <span id="name2"></span>
            <br>
            <br>
            <p>Email: </p>
            <span id="email"></span>
            <br>
            <br>
            <p>Why I support this campaign: </p>
            <span id="tArea"></span>
        </div>
        <script>
            document.getElementById("name1").innerHTML=localStorage.getItem("textvalues");
            document.getElementById("name2").innerHTML=localStorage.getItem("textvalue");
            document.getElementById("email").innerHTML=localStorage.getItem("emailvalues");
            document.getElementById("pword").innerHTML=localStorage.getItem("passwordvalues");
            document.getElementById("tArea").innerHTML=localStorage.getItem("textArea");
        </script>
    </body>
</html>

查看此代码和您的代码之间的区别是什么,我在那里设置了一些评论

。也有一个车身标签

,如果您想获得无线电值,您只需使用以下代码即可

   var radio= document.getElementById("myRadio").value

制作 id =“ myradio” 对所有无线电按钮使用相同的ID,那么上面的代码将获得点击的无线电值

i将代码 home.html profile.html 分开,

您可以在同一文件夹中测试这两个单独的HTML文件。然后将代码并将代码复制到 home.html profile.html 在浏览器中打开 home.html 。输入值后,您的页面将通过输入的数据重定向到 profile.html

**home.html**

    <!DOCTYPE html>
<html lang="en">

 <head>
        
  <style type=text/css>

   ul {list-style-type: none; margin: 0; padding: 0; background-color: rgb(42,157,143); overflow: hidden;}
   li{float: left;} 
   li a:link{display: block; color: black; padding: 10px; text-decoration: none;}
   li a:visited{color: orange;}
   li a:hover {background-color: rgb(38,70,83); color: blue;}
   li a.active {background-color: rgb(138,177,125); color: red;}

   .leftdiv{
      float: up;
    }

    .rightdiv{
       float: down;
       width: 100px;
     }

     div{
       padding : 1%;
       color: blue;
       /* corrected  background color to background-color*/
       background-color: white; 
       width: 40%;
       border: blue;
     }
                    
     span{
        color : blue;
        background-color: white;
        margin: 8px;
        font-size: 25x;

         /* missing the close tag */
      }

      .sprite {
         display:block;
         position:relative;
         width:50px;
         height:50px;
         border:1px solid red;
         overflow:hidden;
       }

       #fb { 
         position:absolute;
         top:0;
         left:0;
            } 

            #fb:hover {
                position:absolute;
                top:-50px;
                left:0;
            }

            form{   
                
                color : blue;
                background-color: white;
                margin: 8px;
                font-size: 25x;
            }

        </style>

        <script>

            function passvalues()

                {
                    var name=document.getElementById("name1").value;
                    localStorage.setItem("textvalues", name);
                    

                    var name=document.getElementById("name2").value;
                    localStorage.setItem("textvalue", name);
                    
                    var radio= document.getElementById("myRadio").value
                    localStorage.setItem("emailvalues", name);

                    var name=document.getElementById("radio").value;
                    localStorage.setItem("emailvalues", name);


                    var name=document.getElementById("pword").value;
                    localStorage.setItem("passwordvalues", name);
                    


                    var name=document.getElementById("tArea").value;
                    localStorage.setItem("textareavalue", name);
                    return false;
                }

        </script>
            
    </head>

    <body>

        <nav>  
          
            <form action="profile.html">
                <!-- missed " in style" -->
                <fieldset form="signup" width=10px; style="border-style:solid; color : black; border-width:1px; padding:10px; text-align:left;"> 
                    <legend>Register: </legend>
    
                    <label for="name1">*First Name:</label>
                    <input type="text" id="name1" name="name1"  required/><br><br>
                    <label for="name2">*Last Name:</label>
                    <input type="text" id="name2" name="name2"  required/><br><br>
    
                    <p>*Your Gender:</p>
                    <input type="radio" id="radio" name="gender" value="Male"  required/>
                    <label for="male">Male</label></br>
                    <input type="radio" id="radio" name="gender" value="Female"  required/>
                    <label for="female">Female</label></br>
                    <input type="radio" id="radio" name="gender" value="Prefer not say"  required/>
                    <label for="prefernotsay">Prefer Not Say</label>
                    
                    <br>
                    <br>
    
                    <label for="email">*Email Address:</label>
                    <input type="email" id="email" name="email"  required/><br><br>
    
                    <label for="number">#Number:</label>
                    <input type="text" id="number" name="Number"  required/><br><br>
    
                    <label for="pword">*Your Password: </label>
                    <input type="password" id="pword" name="pword" required/>
                    
                    <br>
                    <br>
    
                    <label for="cmmnts">*Reasons for registering: </label></br>
                    <input type="textarea" textarea id="tArea" name="cmmnts" rows="4" cols="50" required/> </textarea>
                    
                    <br>
                    <br>
                    <input type="submit" value="Submit" onclick="passvalues()"/>
    
                </fieldset>
            </form>
    
         
        </nav>

    </body>

</html>

**profile.hrml**

    <!DOCTYPE html>
<html>
<head>
</head>

    <style type=text/css>
     
        ul {list-style-type: none; margin: 0; padding: 0; background-color: rgb(42,157,143); overflow: hidden;}
        li{float: left;} 
        li a:link{display: block; color: black; padding: 10px; text-decoration: none;}
        li a:visited{color: orange;}
        li a:hover {background-color: rgb(38,70,83); color: blue;}
        li a.active {background-color: rgb(138,177,125); color: red;}

        .leftdiv{
            float: up;
        }

        .rightdiv{
            float: down;
            width: 100px;
        }

        div{
            padding : 1%;
            color: blue;
            background-color: white;
            width: 40%;
            border: blue;
        }

        span{
            color : blue;
            background-color: white;
            margin: 8px;
            font-size: 25x;
        }

        .sprite {
            display:block;
            position:relative;
            width:50px;
            height:50px;
            border:1px solid red;
            overflow:hidden;
                
        }

        #fb { 
            position:absolute;
            top:0;
            left:0;
        } 

        #fb:hover {
            position:absolute;
            top:-50px;
            left:0;
        }

    </style>

    <body>
        <div>
            <p>First Name: </p>
            <span id="name1"></span>
            <br>
            <br>
            <p>Last Name: </p>
            <span id="name2"></span>
            <br>
            <br>
            <p>Email: </p>
            <span id="email"></span>
            <br>
            <br>
            <p>Why I support this campaign: </p>
            <span id="tArea"></span>
        </div>
        <script>
            document.getElementById("name1").innerHTML=localStorage.getItem("textvalues");
            document.getElementById("name2").innerHTML=localStorage.getItem("textvalue");
            document.getElementById("email").innerHTML=localStorage.getItem("emailvalues");
            document.getElementById("pword").innerHTML=localStorage.getItem("passwordvalues");
            document.getElementById("tArea").innerHTML=localStorage.getItem("textArea");
        </script>
    </body>
</html>

see what is the different between this code and your code I have set some comments there you have missed small parts in your code (you have done same mistakes in profile.html)

as well as dont use two body tag and you haven't close one body tag too

And if you want to get radio values you can simply use following code

   var radio= document.getElementById("myRadio").value

just make id="myRadio" use same ID for all the radio button then above code will get the clicked radio value

I have separate the code home.html and profile.html

You can test this creating two separate html file in same folder . Then copy and past the code to home.html and profile.html open the home.html in browser. after you input the value your page will be redirect to profile.html with the data that you input.

注册后重定向到个人资料页面

别想她 2025-02-10 18:08:13

使用 map()从旧数组创建一个新数组。使用省略号将新属性合并为旧对象的副本。

const data = [
      {car: 'Hyundai', price: '60.00', tax: '5.00', total: 0},
      {car: 'Honda', price: '80.00', tax: '7.00', total: 0},
      {car: 'Tesla', price: '100.00', tax: '10.00', total: 0},
  ];
const newData = data.map((car) => ({...car, total: Number(car.price) + Number(car.tax)}));
console.log(newData);

Use map() to create a new array from the old array. Use ellipsis to merge the new property into a copy of the old object.

const data = [
      {car: 'Hyundai', price: '60.00', tax: '5.00', total: 0},
      {car: 'Honda', price: '80.00', tax: '7.00', total: 0},
      {car: 'Tesla', price: '100.00', tax: '10.00', total: 0},
  ];
const newData = data.map((car) => ({...car, total: Number(car.price) + Number(car.tax)}));
console.log(newData);

创建一个带有2个字段的新数组

别想她 2025-02-10 17:37:12

过滤器选项的逻辑' 标签 '对于管道运行是' '而不是' '。实际上,在其他过滤器选项上相同。

因此,当您在' 标签下选择多个标签 '选项时,它将列出具有任何选定标签的所有管​​道运行,而不仅仅是具有所有标签的运行选定的标签。

The logic of the filter option 'Tags' for the pipeline runs is 'OR' rather than 'AND'. In fact, same on other filter options.

So, when you select multiple tags under the 'Tags' option, it would list all the pipeline runs which have any of the selected tags, not only the runs which have all the selected tags.

如何使用2个或更多标签过滤Azure管道运行?

别想她 2025-02-10 11:06:27

Docker分布不提供这种粒度水平。您可以自己构建一些东西,使得在注册表的前面有一个反向代理,该注册表具有所需的逻辑或使用更高级的解决方案,例如或者如果您想要它真的很轻,也许 trow 也适合该法案。

Docker Distribution does not provide such level of granularity. You can build something yourself such a put a reverse proxy in front of the registry that has the logic you need or use a more advanced solution such as Harbor or if you want it really light wight, maybe trow fits the bill as well.

如何使用htpasswd设置多个docker注册表的多个用户,每个用户都只能访问其个人路径?

别想她 2025-02-10 10:51:21

我将Visual Studio代码与Docker扩展名一起自动创建Python。

默认情况下,它具有此行,

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

它可以正常工作并显示集装箱以独立模式运行时的日志,因此我认为这是首选的方式。我使用python 3.11

I use visual studio code with docker extension to create Dockerfile in python automatically.

By default it have this line

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

it works and show logs when container run in detached mode, so I think that's the preferred way. I use python 3.11

为什么在独立的Docker容器中运行时,为什么不打印任何东西?

别想她 2025-02-10 06:09:20

我决定留在C ++ 11标准中。当然,交换有助于解决问题。

#include <cstdlib>
#include <iostream>
#include <iomanip>

#define rows 4
#define cols 4
using Arr = int[rows][cols];

std::pair<int, int> high_low_ids(const Arr arr, int nrow = rows, int ncol = cols) {
    int highpos = 0, lowpos = 0;
    int high = arr[0][0];
    int low = arr[0][0];
    for(int i = 0; i < nrow; ++i)
        for(int j = 0; j < ncol; ++j)
            if(arr[i][j] > high) {
                highpos = j;
                high=arr[i][j];
            }
            else if(arr[i][j] < low) {
                lowpos = j;
                low=arr[i][j];
            }
    std::cout << "\nBiggest element:" <<high<< "\nSmallest:" << low << "\n";
    return {highpos, lowpos};
}
void rows_swap(Arr table2d, int nrow = rows){
    auto p = high_low_ids(table2d);
    const int high_idx = p.first;
    const int low_idx = p.second;
    if (high_idx == low_idx)
        return;
    for (int i = 0; i < nrow; ++i) {
        std::swap(table2d[i][high_idx], table2d[i][low_idx]);
    }
}
void print_arr(Arr arr, int nrow = rows, int ncol = cols) {
    for (int i = 0; i < nrow; i++) {
        for (int j = 0; j < ncol; j++)
            std::cout << std::left << std::setw(6) << arr[i][j];
        std::cout << std::endl;
    }
}
int main () {
    srand(time(0));
    Arr arr;
    for (int i = 0; i < rows; ++i)
        for (int j=0; j<cols; ++j)
            arr[i][j] = 1 + (rand() % 200); 
    std::cout << "Random 2d generated array:\n";
    print_arr(arr);
    rows_swap(arr);
    std::cout << "Swapped array:\n";
    print_arr(arr);
    return 0;
}

PS。请使用命名空间std 避免

I decided to stay in c++11 standard. Of course swap helps do the trick.

#include <cstdlib>
#include <iostream>
#include <iomanip>

#define rows 4
#define cols 4
using Arr = int[rows][cols];

std::pair<int, int> high_low_ids(const Arr arr, int nrow = rows, int ncol = cols) {
    int highpos = 0, lowpos = 0;
    int high = arr[0][0];
    int low = arr[0][0];
    for(int i = 0; i < nrow; ++i)
        for(int j = 0; j < ncol; ++j)
            if(arr[i][j] > high) {
                highpos = j;
                high=arr[i][j];
            }
            else if(arr[i][j] < low) {
                lowpos = j;
                low=arr[i][j];
            }
    std::cout << "\nBiggest element:" <<high<< "\nSmallest:" << low << "\n";
    return {highpos, lowpos};
}
void rows_swap(Arr table2d, int nrow = rows){
    auto p = high_low_ids(table2d);
    const int high_idx = p.first;
    const int low_idx = p.second;
    if (high_idx == low_idx)
        return;
    for (int i = 0; i < nrow; ++i) {
        std::swap(table2d[i][high_idx], table2d[i][low_idx]);
    }
}
void print_arr(Arr arr, int nrow = rows, int ncol = cols) {
    for (int i = 0; i < nrow; i++) {
        for (int j = 0; j < ncol; j++)
            std::cout << std::left << std::setw(6) << arr[i][j];
        std::cout << std::endl;
    }
}
int main () {
    srand(time(0));
    Arr arr;
    for (int i = 0; i < rows; ++i)
        for (int j=0; j<cols; ++j)
            arr[i][j] = 1 + (rand() % 200); 
    std::cout << "Random 2d generated array:\n";
    print_arr(arr);
    rows_swap(arr);
    std::cout << "Swapped array:\n";
    print_arr(arr);
    return 0;
}

PS. please avoid using namespace std.

如何在某些地方交换2D数组列?

别想她 2025-02-10 00:44:43

使用Postman

URL:

https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/messages

对象:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "5500900050006",
    "type": "image",
    "image": {
        "link": "https://images.ecycle.com.br/wp-content/uploads/2021/05/20195924/o-que-e-paisagem.jpg"
    }
}

不要忘记...
一些Web服务器不允许访问文件...

Example using Postman

URL:

https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/messages

OBJECT:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "5500900050006",
    "type": "image",
    "image": {
        "link": "https://images.ecycle.com.br/wp-content/uploads/2021/05/20195924/o-que-e-paisagem.jpg"
    }
}

Don't forget...
Some web server does not permit access to files...????

使用WhatsApp Cloud API发送图像

别想她 2025-02-09 20:00:05

我将首先尝试使用SQL Client(PSQL,MySQL-CLIENT,无论您拥有的DB​​,nocker nocker)首先尝试从运行Docker容器内部(通过Docker Exec)连接此DB,然后您可以做到这一点。如果不是显然,DB级别的SMTH不允许在DB设置中仅允许连接127.0.0.1

i would start with first trying to connect to this DB from inside the running docker container (via docker exec) using SQL client (psql, mysql-client whatever the DB you have) and connfirm you can do it. If not obviously smth on DB level doesn't allow the connection possibly only 127.0.0.1 is allowed in the DB settings

如何从Dockerized Python应用程序连接到本地SQL Server数据库

别想她 2025-02-09 18:19:47

如果Symfony也在Docker中运行,您可以尝试在Docker-Compose.yml中直接定义Env,并通过Postgres“服务”名称/Alias(Docker(Docker)(docker将解决此名称)

STH(在Symfony Service Service定义)

 environment:
      - DATABASE_URL="postgresql://root:root@db/my_db?serverVersion=12&charset=utf8"

中,其中“ db”其中是您对Postgres的服务名称,

我遇到了类似问题,对我来说,这种别名对此有所帮助。

If Symfony is also running in docker, you can try to define ENV directly in docker-compose.yml and pass postgres "service" name/alias (docker will resolve this name)

sth like this (in symfony service definition)

 environment:
      - DATABASE_URL="postgresql://root:root@db/my_db?serverVersion=12&charset=utf8"

where "db" is your service name for postgres

I had similar issue and for me this alias helped.

docker -host.docker.internal; (192.168.65.2)拒绝连接

别想她 2025-02-09 12:09:32

您可以使用替换 - 项目记者来更新列表中的项目。

Let this [ 1 2 3 4 ]
Let new-list replace-item 3 this “a”
Print new-list

请注意,这不会影响原始列表:它报告了一个新列表,其指定项目替换为给定值。

更改类似列表列表中的项目。但是,整个列表再次
列表的重新创建。

但是也许使用链接?

如果使用乌龟的列表来跟踪其与其他海龟或群体的关系,链接很有用,并简化管理这些关系,并启用列表非常困难的事情。

链接只是另一种代理,专门用于记录两只乌龟之间的关系。他们有一对内置变量, end1 end2 ,它是指这两只乌龟。链接的 -ONT 变量可用于记录关系的属性。例如“周年纪念日”或“亲和力”或其他!链接可以是方向性的,因此“亲密”值可能会有所不同,具体取决于关系的“方向”。

Directed-link-breed [ relationships relationship]
Relationships-own [ intimacy ]

to setup-all-relationships
  Ask protestors
  [ setup-relationship ]
End

To setup-relationship
  ;; link with everyone else 
  Create-relationships-to other protestor
  [ set intimacy .5 ]
End

两只乌龟之间的关系可以通过多种方式获得。

(链接(这乌龟)(那只乌龟))

是指从这乌龟到那只乌龟的联系。

超链近脑用于从这只乌龟中获得与所有乌龟相关的一组。

您还可以使用海龟表示群体,并链接以记录该组的成员资格。

在这种情况下,组成员是组的 link-neighbors

虽然也许不是您的模型的特征,但这打开了多个组和代理人是一个以上组的成员的可能性,或者是跟踪前成员之类的事情。

You can use the replace-item reporter to update an item in a list.

Let this [ 1 2 3 4 ]
Let new-list replace-item 3 this “a”
Print new-list

Note that this does not affect the original list: it reports a new list with the specified item replaced with the given value.

Changing an item in a list of lists of similar.. but again, the entire list
Of lists is created anew.

But maybe use links?

In the case of using a list for a turtle to track its relationship with other turtles, or of groups, links are useful, and simplify managing those relationships, and enable things that are very difficult with lists.

LINKS are just another kind of agent, specifically for recording a relationship between two turtles. They have a pair of built-in variables, end1 and end2 that refer to those two turtles. The -own variables of the link can be used to record properties of the relationship. Like “anniversary” or “affinity” or whatever! Links can be directional, so the “intimacy” value can be different depending on the “direction” of the relationship.

Directed-link-breed [ relationships relationship]
Relationships-own [ intimacy ]

to setup-all-relationships
  Ask protestors
  [ setup-relationship ]
End

To setup-relationship
  ;; link with everyone else 
  Create-relationships-to other protestor
  [ set intimacy .5 ]
End

The relationship between two turtles can be obtained in several ways.

(Link (this turtle) (that turtle))

Refers to the link from this turtle to that turtle.

Out-Link-neighbors is used to get the set of all turtles linked to from this turtle.

You can also use turtles to represent groups, and links to record membership in that group.

In that case, the members of the group are link-neighbors of the group.

While perhaps not a feature of your model, this opens up the possibility of multiple groups and of agents being members of more than one group, or of tracking things like former members.

迭代列表以更新列表中的特定项目

别想她 2025-02-09 11:42:20

效率取决于两个输入中的哪一个是最不变的。例如,如果 list_a 保持不变,但是您有不同的字符串可以测试,则可能值得将列表变成正则表达式,然后将其用于不同的字符串。

这是一个解决方案,您可以在其中为给定列表创建类的实例。然后反复使用此实例进行不同的字符串:

import re

class Matcher:
    def __init__(self, lst):
        self.regex = re.compile(r"\b(" + "|".join(re.escape(key) for key in lst) + r")\b")

    def typeof(self, s):
        return "L1" if self.regex.search(s) else "L2"

# demo

list_a = ['AA', 'BB', 'CC']

matcher = Matcher(list_a)

string_tmp = 'Hi AA How Are You'
print(matcher.typeof(string_tmp))  # L1

string_tmp = 'Hi DD How Are You'
print(matcher.typeof(string_tmp))  # L2

此正则表达式的副作用是,当它们附近的标点符号时,它也与单词匹配。例如,当字符串为'hi aa时,上面仍然会返回“ L1”,您好吗(带有附加逗号)。

Efficiency depends on which of the two inputs is the most invariant. For instance, if list_a remains the same, but you have different strings to test with, then it may be worth to turn that list into a regular expression and then use it for different strings.

Here is a solution where you create an instance of a class for a given list. Then use this instance repeatedly for different strings:

import re

class Matcher:
    def __init__(self, lst):
        self.regex = re.compile(r"\b(" + "|".join(re.escape(key) for key in lst) + r")\b")

    def typeof(self, s):
        return "L1" if self.regex.search(s) else "L2"

# demo

list_a = ['AA', 'BB', 'CC']

matcher = Matcher(list_a)

string_tmp = 'Hi AA How Are You'
print(matcher.typeof(string_tmp))  # L1

string_tmp = 'Hi DD How Are You'
print(matcher.typeof(string_tmp))  # L2

A side effect of this regular expression is that it also matches words when they have punctuation near them. For instance, the above would still return "L1" when the string is 'Hi AA, How Are You' (with the additional comma).

如何使用lambda进行内部循环?

别想她 2025-02-09 02:24:20
from bs4 import BeautifulSoup
html = '''<div class="example" style="height: 50%;"></div>
<div class="example" style="height: 20%;"></div>
<div class="example" style="height: 40%;"></div>'''


soup = BeautifulSoup(html, 'lxml')
goal = [x['style'].split()[1][:-1] for x in soup.select('.example')]
print(goal)

输出:

['50%', '20%', '40%']
from bs4 import BeautifulSoup
html = '''<div class="example" style="height: 50%;"></div>
<div class="example" style="height: 20%;"></div>
<div class="example" style="height: 40%;"></div>'''


soup = BeautifulSoup(html, 'lxml')
goal = [x['style'].split()[1][:-1] for x in soup.select('.example')]
print(goal)

Output:

['50%', '20%', '40%']

Python BS4如何从find_all()找到内联样式

别想她 2025-02-08 22:31:47

lltoa 函数中,您拥有:

static char buf[64] = {0};

当将local变量定义为 static 时,这意味着只有一个一个单个实例调用功能。

因此,当您调用 lltoa(Decimal_2,10) buf 的内容以一种方式设置。然后在第二个呼叫中 lltoa(十进制,10)您覆盖 buf 的内容。

而且,由于您只有一个 buf ,所以指针 a b 都将指向这一单个 buf

由于您希望能够处理不同的基础,因此您无法按照我的建议使用标准 snprintf ,因此我的建议是,您将指针传递给足够大的缓冲区作为参数:

char *lltoa(long long val, int base, char *buf, size_t buflen);

Inside the lltoa function you have:

static char buf[64] = {0};

When you define a local variable as static it means there's only one single instance of the variable, shared between all calls to the function.

So when you call lltoa(decimal_2, 10) the contents of buf is set up one way. Then in the second call lltoa(decimal, 10) you overwrite the contents of buf.

And since you only have a single buf, both the pointers a and b will both point to this one single buf.

Since you want to be able to handle different bases you can't use the standard snprintf as I would otherwise suggest, so my recommendation is that you pass a pointer to a large enough buffer as an argument:

char *lltoa(long long val, int base, char *buf, size_t buflen);

试图限制两个指针char,但其中之一正在改变

别想她 2025-02-08 14:12:58

我解决了问题。您不能使用但是。Place
从tkinter导入 *

def opendl():
    global installpin2
    
# dl = install
root.destroy()
dlwin = Tk()
#functions
def openinstall():
    os.startfile('E:\bigdirectory\PROGRAMS\shortcut.lnk')
#images
dlwin.title("subwindow title")
dlwin.resizable(False, False)
installpin = Image.open('E:\bigdirectory\GUI\img\Folder catalog.ico')
installpinr = installpin.resize((181, 185), Image.ANTIALIAS)
installpin2 = ImageTk.PhotoImage(installpinr)
#code
dlcanvas = Canvas(dlwin, height=500, width=1500)
dlframe = Frame(dlwin, bg='#3D3E40') # R61,G62,B64
dlframe.place(relheight=1, relwidth=1)
label = Label(dlframe, text="biglabel", font=("vga932", 35), bg='#3D3E40', fg='white')
label.place(height=230, relwidth=1)
line = Canvas(dlframe, bg='white')
line.place(height=3, width=900, relx=.20, y=145)
buttoncon = Frame(dlframe, bg='#3D3E40', highlightthickness=0, relief='flat', width=1500)
labelbcon = Label(buttoncon, text="Install Program", font=(default), bg='#3D3E40', fg='white')
labelbcon.place(relx=.3, y=220)
but = Button(buttoncon, command=openinstall, image=installpin2, bg='#3D3E40', fg='#3D3E40', relief='flat', cursor='plus')
but.config(height = 2, width = 15)
but.grid(padx=25, pady=25,sticky = S)
buttoncon.place(y=150)
dlcanvas.pack()
dlwin.mainloop

outut:

顺便说一句,我没有在标题上添加图标。您可能需要解决 newnbie

如您所见, buttoncon.place 因此,我添加x轴和对象我更改,但是= button(dlframe not buttoncon。您必须修复x和y。
来自tkinter导入 *

def opendl():
    global installpin2
    
# dl = install
root.destroy()
dlwin = Tk()
#functions
def openinstall():
    os.startfile('E:\bigdirectory\PROGRAMS\shortcut.lnk')
#images
dlwin.title("subwindow title")
dlwin.resizable(False, False)
installpin = Image.open('E:\bigdirectory\GUI\img\Folder catalog.ico')
installpinr = installpin.resize((181, 185), Image.ANTIALIAS)
installpin2 = ImageTk.PhotoImage(installpinr)
#code
dlcanvas = Canvas(dlwin, height=500, width=1500)
dlframe = Frame(dlwin, bg='#3D3E40') # R61,G62,B64
dlframe.place(relheight=1, relwidth=1)
label = Label(dlframe, text="biglabel", font=("vga932", 35), bg='#3D3E40', fg='white')
label.place(height=230, relwidth=1)
line = Canvas(dlframe, bg='white')
line.place(height=3, width=900, relx=.20, y=145)
buttoncon = Frame(dlframe, bg='#3D3E40', highlightthickness=0, relief='flat', width=1500)
labelbcon = Label(buttoncon, text="Install Program", font=(default), bg='#3D3E40', fg='white')
labelbcon.place(relx=.3, y=220)
but = Button(dlframe,, command=openinstall, image=installpin2, bg='#3D3E40', fg='#3D3E40', relief='flat', cursor='plus')
but.config(height = 2, width = 15)
but.grid(padx=25, pady=25,sticky = S)
#buttoncon.config(height = 2, width = 55) 
buttoncon.place(x=5, y=10)
dlcanvas.pack()
dlwin.mainloop

输出:

”在此处输入图像描述”

I solved problem. You can't use but.place
from tkinter import *

def opendl():
    global installpin2
    
# dl = install
root.destroy()
dlwin = Tk()
#functions
def openinstall():
    os.startfile('E:\bigdirectory\PROGRAMS\shortcut.lnk')
#images
dlwin.title("subwindow title")
dlwin.resizable(False, False)
installpin = Image.open('E:\bigdirectory\GUI\img\Folder catalog.ico')
installpinr = installpin.resize((181, 185), Image.ANTIALIAS)
installpin2 = ImageTk.PhotoImage(installpinr)
#code
dlcanvas = Canvas(dlwin, height=500, width=1500)
dlframe = Frame(dlwin, bg='#3D3E40') # R61,G62,B64
dlframe.place(relheight=1, relwidth=1)
label = Label(dlframe, text="biglabel", font=("vga932", 35), bg='#3D3E40', fg='white')
label.place(height=230, relwidth=1)
line = Canvas(dlframe, bg='white')
line.place(height=3, width=900, relx=.20, y=145)
buttoncon = Frame(dlframe, bg='#3D3E40', highlightthickness=0, relief='flat', width=1500)
labelbcon = Label(buttoncon, text="Install Program", font=(default), bg='#3D3E40', fg='white')
labelbcon.place(relx=.3, y=220)
but = Button(buttoncon, command=openinstall, image=installpin2, bg='#3D3E40', fg='#3D3E40', relief='flat', cursor='plus')
but.config(height = 2, width = 15)
but.grid(padx=25, pady=25,sticky = S)
buttoncon.place(y=150)
dlcanvas.pack()
dlwin.mainloop

Ouput:
enter image description here

Btw, I did not add icon on title. You may have to fix for newnbie.

As you can see buttoncon.place So I Add x axis and object I change but = Button(dlframe not buttoncon. You will have to fix x and y.
from tkinter import *

def opendl():
    global installpin2
    
# dl = install
root.destroy()
dlwin = Tk()
#functions
def openinstall():
    os.startfile('E:\bigdirectory\PROGRAMS\shortcut.lnk')
#images
dlwin.title("subwindow title")
dlwin.resizable(False, False)
installpin = Image.open('E:\bigdirectory\GUI\img\Folder catalog.ico')
installpinr = installpin.resize((181, 185), Image.ANTIALIAS)
installpin2 = ImageTk.PhotoImage(installpinr)
#code
dlcanvas = Canvas(dlwin, height=500, width=1500)
dlframe = Frame(dlwin, bg='#3D3E40') # R61,G62,B64
dlframe.place(relheight=1, relwidth=1)
label = Label(dlframe, text="biglabel", font=("vga932", 35), bg='#3D3E40', fg='white')
label.place(height=230, relwidth=1)
line = Canvas(dlframe, bg='white')
line.place(height=3, width=900, relx=.20, y=145)
buttoncon = Frame(dlframe, bg='#3D3E40', highlightthickness=0, relief='flat', width=1500)
labelbcon = Label(buttoncon, text="Install Program", font=(default), bg='#3D3E40', fg='white')
labelbcon.place(relx=.3, y=220)
but = Button(dlframe,, command=openinstall, image=installpin2, bg='#3D3E40', fg='#3D3E40', relief='flat', cursor='plus')
but.config(height = 2, width = 15)
but.grid(padx=25, pady=25,sticky = S)
#buttoncon.config(height = 2, width = 55) 
buttoncon.place(x=5, y=10)
dlcanvas.pack()
dlwin.mainloop

Output:

enter image description here

tkinter按钮图像不加载(Toplevel)

别想她 2025-02-08 14:05:17

您可以使用 col.quer.squeryselector('input')。值,可以检索&lt; input&gt; 嵌套在表单元中的元素。

我在您的代码上制作了此演示:

var table = document.getElementById("data");
for (var i = 0, row; row = table.rows[i]; i++) 
{
  for (var j = 0, col; col = row.cells[j]; j++) {
    const inputElement = col.querySelector('input');
    //just in case there's no input element inside the td
    if (inputElement !== null){
       const value = inputElement.value;
       console.log( value );
    }        
  }  
}
tr{
  display: flex;
  flex-direction: column;
}
<table id="data">
   <tr>
      <td>
          <input type="text" name="id" id="id" value="<%=rn%>">
      </td>
      <td>
          <input type="text" name="name" id="name" value="<%=na%>">
      </td>
      <td>
          <input type="text" name="location" id="location" value="<%=pe%>">
      </td>
      <td>
          <input type="text" name="nbed" id="nbed" value="<%=ad%>">
      </td>
      <td>
          <input type="text" name="obed" id="obed" value="<%=obed%>">
      </td>
      <td>
          <input type="text" name="ibed" id="ibed" value="<%=ibed%>">
      </td>    
   </tr>
</table>

You can retrieve the value of <input> elements nested inside the table cells, using col.querySelector('input').value.

I crafted this demo on top of your code:

var table = document.getElementById("data");
for (var i = 0, row; row = table.rows[i]; i++) 
{
  for (var j = 0, col; col = row.cells[j]; j++) {
    const inputElement = col.querySelector('input');
    //just in case there's no input element inside the td
    if (inputElement !== null){
       const value = inputElement.value;
       console.log( value );
    }        
  }  
}
tr{
  display: flex;
  flex-direction: column;
}
<table id="data">
   <tr>
      <td>
          <input type="text" name="id" id="id" value="<%=rn%>">
      </td>
      <td>
          <input type="text" name="name" id="name" value="<%=na%>">
      </td>
      <td>
          <input type="text" name="location" id="location" value="<%=pe%>">
      </td>
      <td>
          <input type="text" name="nbed" id="nbed" value="<%=ad%>">
      </td>
      <td>
          <input type="text" name="obed" id="obed" value="<%=obed%>">
      </td>
      <td>
          <input type="text" name="ibed" id="ibed" value="<%=ibed%>">
      </td>    
   </tr>
</table>

如何使表中TD标签的内部HTML中存在值

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文